const fetchHotData = {
  getHot_Baidu: function (todayHot) {
    fetch('http://localhost:8080/GetHotToday/baidu', {
      mode: 'cors', //跨域请求
      headers: {
        'Content-Type': 'application/json',
      },
    })
      .then(response => response.json())
      .then(json => {
        todayHot.value.baidu = json;
      });
  },
  getHot_Weibo: function (todayHot) {
    fetch('http://localhost:8080/GetHotToday/weibo', {
      mode: 'cors', //跨域请求
      headers: {
        'Content-Type': 'application/json',
      },
    })
      .then(response => response.json())
      .then(json => {
        todayHot.value.weibo = json;
      });
  },
  getHot_Toutiao: function (todayHot) {
    fetch('http://localhost:8080/GetHotToday/toutiao', {
      mode: 'cors', //跨域请求
      headers: {
        'Content-Type': 'application/json',
      },
    })
      .then(response => response.json())
      .then(json => {
        todayHot.value.toutiao = json;
      });
  },
  getHot_Zhihu: function (todayHot) {
    fetch('http://localhost:8080/GetHotToday/zhihu', {
      mode: 'cors', //跨域请求
      headers: {
        'Content-Type': 'application/json',
      },
    })
      .then(response => response.json())
      .then(json => {
        todayHot.value.zhihu = json;
      });
  },
  getHot_Bilibili: function (todayHot) {
    fetch('http://localhost:8080/GetHotToday/bilibili', {
      mode: 'cors', //跨域请求
      headers: {
        'Content-Type': 'application/json',
      },
    })
      .then(response => response.json())
      .then(json => {
        todayHot.value.bilibili = json;
      });
  },
  getHot_Tieba: function (todayHot) {
    fetch('http://localhost:8080/GetHotToday/tieba', {
      mode: 'cors', //跨域请求
      headers: {
        'Content-Type': 'application/json',
      },
    })
      .then(response => response.json())
      .then(json => {
        todayHot.value.tieba = json;
      });
  },

  test: function () {
    fetch('http://localhost:8080/test/test', {
      mode: 'cors', //跨域请求
      headers: {
        'Content-Type': 'application/json',
      },
    })
      .then(response => response.json())
      .then(json => {
        console.log(json);
      });
  },
};

export default fetchHotData;
